##########################################
## "Voters get what they want"          ##
##########################################
## Heinrich, Kobayashi, Long            ##
##########################################

##          
## TSCS analysis of subset models, aid ~ hierarchy, human rights violations
## Script 03
## June 29, 2017


## Load data
############
load("output/data_SH.Rdata")
load("output/data_EH.Rdata")


## Specifications
################# 
A <- c("Economic hierarchy", "Security hierarchy")
B <- data.frame(Name=c("Top 40", "Top 20", "Lowest 40", "Lowest 20"), 
                Lower=c(0.6, 0.8, 0.0, 0.0),
                Upper=c(1.0, 1.0, 0.4, 0.2))
C <- c("Leader", "Human rights")
ABCs <- list(A=A, B=B, C=C,  
             FM=gen.factorial(levels=c(length(A), nrow(B), length(C)),
                              factors="all",
                              varNames=LETTERS[1:3]))


## Estimation
#############
foreach(i=1:nrow(ABCs$FM)) %dopar% estimate_A1_subset(to_estimate=i, 
                                                      niter=niter, burnin=burnin, 
                                                      chains=chains, thin=thin, ABCs=ABCs)
